from django.test import TestCase
from tasks import weekly_report
from app_info.models import AppVersion,App
from notification.models import ReportReceiver
import settings

class WeekReportTest(TestCase):
    def setUp(self):
        settings.EMAIL_HOST = 'smtp.163.com'
        settings.EMAIL_HOST_USER = 'coblan'
        settings.EMAIL_HOST_PASSWORD = 'he123811'
        settings.EMAIL_HOST_USER = 'coblan@163.com'
        # EMAIL_HOST_PASSWORD = WRITER_PWD
        settings.EMAIL_SUBJECT_PREFIX = '[PTS_STAGING]'        
        
        app=App.objects.create(studio_id='1')
        AppVersion.objects.create(status='L', app=app)
        ReportReceiver.objects.create(name='heyulin',email='heyulin@smalltreemedia.com',is_active=True)
        ReportReceiver.objects.create(name='liriqiang',email='liriqiang@smalltreemedia.com',is_active=True)
    
    def test_weekreport(self):
        weekly_report()